Skip to main content

Lex Sub Customers Import

Introduction

This will import lex sub customers.

download sample sub-customers import file.

Fields

Lex Sub Customers Import

Lex Customer contract fieldsMap to ViSN Column NameDescriptionMax lengthRules MandatoryDefault ValueExample
CustomerNameCustomer NameCustomer Name100A-Z & 0-9 and special charactersNHeaney - Rath
CustomerAccountNoAccount NumberAccount Number15A-Z & 0-9 and special charactersYASI537945
StandardInstructionsCustomer Policy NotesCustomer Policy Notes8000All Characters and Special CharactersNThe TCP port is down, reboot the bluetooth protocol.
ContactNameContact NameContact Name100A-Z & 0-9 and special charactersNKaycee
TelephoneNumberContact NumberCustomer Contact number110-9 numbersN01234567891
eMailAddressContact EmailCustomer Contact Email address50All Characters and Special CharactersNjitendra+djkoce@digitalinnk.com
CustomerReferralLimitReferral LimitReferral Limit7All Characters and Special CharactersN300
Lex Customer contract fieldsDescriptionMax lengthRules MandatoryDefault ValueExample
MaintenanceControllerNotesMaintenanceControllerNotes8000All Characters and Special CharactersNThe TCP port is down, reboot the bluetooth protocol so we can input the CSS panel!
TyreBrandPreference1TyreBrandPreference110All Characters and Special CharactersNDFGH-THYU
TyreBrandPreference2TyreBrandPreference210All Characters and Special CharactersNDFGH-TPYU
TyreBrandPreference3TyreBrandPreference310All Characters and Special CharactersNDFGH-TUDU
TyreBrandPreference4TyreBrandPreference410All Characters and Special CharactersNDFGH-TTKU
TyreBrandPreference5TyreBrandPreference510All Characters and Special CharactersNDFGH-TOYU

Importing a file

Preparation

  1. Create a new branch with Jira task number in the branch name

  2. Delete all the files in importFiles folder

  3. Create a folder with the current sprint number

  4. Copy the file that needs to be imported

  5. Go to package.json , find the line validate:lexSubCustomers

  6. Modify --leaseId with the required lease Id

  7. Modify --file with the relative path of the file

  8. Save package.json

Validating locally

  1. in a terminal run npm run build

  2. in a terminal run npm run validate:lexSubCustomers

  3. If there are no errors, push the code

Validating in workflow

  1. Go to Action of Import-manger

  2. Find <Environment> - on-demand-import

  3. Select the branch that was created for this import

  4. Enter script name as validate:lexSubCustomers

  5. Leave Overrides empty

Importing the file

  1. If the validation has passed

  2. Go to Action of Import-manger

  3. Find <Environment> - on-demand-import

  4. Select the branch that was created for this import

  5. Enter script name as import:lexSubCustomers

  6. Enter --persist in Overrides field

Importing the file via cloud run

Creating Schedulers for validating the lex-sub-customers

  1. Go to Cloud Scheduler and select the CREATE JOB

Setup Required

A Scheduler should be created cloud scheduler with the following parameters

  • Name: lex_sub_customer_import_file_validation
  • Region: europe-west2
  • Frequency: 0 0 31 12 1
  • TimeZone: GMT London
  • Target type: HTTP
  • URL: https://import-manager-36r2bu4izq-uc.a.run.app/import-subCustomers
  • HTTP method: POST
  • Auth header: select OIDC token
  • Service account: cloud-run-import-customer-contract
  • body: a JSON object including the following parameters

JSON object for lex_sub_customer_import_file_validation scheduler

{
"leaseId": "QJKgdjS4I02sEia4yTne",
"leaseCompanyName": "Next Fleet Services",
"persist": "false",
"bucket": "biddirect-2.appspot.com",
"appDirectory": "/usr/src/app/",
"importPath": "imports/fileDrop/",
"importFileDropPath": "imports/fileDrop/",
"importFileName": "lexSubCustomer.csv",
"email": "mailgun@digitalinnk.com",
"fatalErrorEmailToAddress": "mailgun@digitalinnk.com",
"schema": "LEX_SUB_CUSTOMER"
}

Create scheduler for validating the lex-sub-customers

Creating Schedulers for importing the lex-sub-customers

  1. Go to Cloud Scheduler and select the CREATE JOB

Setup Required

A Scheduler should be created cloud scheduler with the following parameters

  • Name: lex_sub_customer_file_import
  • Region: europe-west2
  • Frequency: 0 0 31 12 1
  • TimeZone: GMT London
  • Target type: HTTP
  • URL: https://import-manager-36r2bu4izq-uc.a.run.app/import-subCustomers
  • HTTP method: POST
  • Auth header: select OIDC token
  • Service account: cloud-run-import-customer-contract
  • body: a JSON object including the following parameters

JSON object for lex_sub_customer_file_import scheduler

{
"leaseId": "QJKgdjS4I02sEia4yTne",
"leaseCompanyName": "Next Fleet Services",
"persist": "true",
"bucket": "biddirect-2.appspot.com",
"appDirectory": "/usr/src/app/",
"importPath": "imports/fileDrop/",
"importFileDropPath": "imports/fileDrop/",
"importFileName": "lexSubCustomer.csv",
"email": "mailgun@digitalinnk.com",
"fatalErrorEmailToAddress": "mailgun@digitalinnk.com",
"schema": "LEX_SUB_CUSTOMER"
}

Create scheduler for importing the lex-sub-customers

Preparation:

  1. Bucket name is biddirect-2.appspot.com and it will vary for higher envs and the file path should imports/fileDrop, where you can drop the CSV file named "lexSubCustomer". This action will place the file in the specified location within the designated bucket.

Validation:

  1. Go to Cloud Scheduler
  2. Run lex_sub_customer_import_file_validation job (job name could be different on other env)
logs in cloud

Importing:

  1. Go to Cloud Scheduler
  2. Run lex_sub_customer_file_import job (job name could be different on other env)
logs in cloud

Testing

  1. Lex Sub-customers will be created under customer. You can verify this by navigating to the ViSN customer platform and selecting Settings > Customers.
Status: Pending Approval
Category: Protected
Authored By: Harish on March 14, 2024
Revisions